import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common';
import { AppConfigModule } from './module/config/app.config.module';
import { AuthModule } from './module/auth/auth.module';
import { DbConfigModule } from './module/config/db.config.module';
import { UserModule } from './module/user/user.module';
import { RedisModule } from './module/redis/redis.module';
import { LoggerMiddleware } from './common/middlewares/logger.middleware';
import { PermissionModule } from './module/permission/permission.module';
import { RoleModule } from './module/role/role.module';
import { UploadModule } from './module/upload/upload.module';
import { ChatModule } from './module/chat/chat.module';

@Module({
  imports: [
    AppConfigModule,
    DbConfigModule,
    RedisModule,
    AuthModule,
    UserModule,
    PermissionModule,
    RoleModule,
    UploadModule,
    ChatModule,
  ],
  controllers: [],
  providers: [],
})
export class AppModule implements NestModule {
  configure(consumer: MiddlewareConsumer) {
    consumer.apply(LoggerMiddleware).forRoutes('*');
  }
}
